package java_9_12;

import java.util.Calendar;
import java.util.Scanner;

/*
6月的第3个星期日是父亲节，由用户输入年份，算出该年的父亲节是哪一天
*/
public class Test_7 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入年份");
        int year = in.nextInt();
        Calendar c=Calendar.getInstance();
        c.set(Calendar.YEAR,year);
        c.set(Calendar.MONTH,5);
        int maximum = c.getActualMaximum(Calendar.DATE);
        int max=0;
        for (int i=1;i<=maximum;i++) {
            c.set(Calendar.DATE, i);
            if (c.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
                max++;
                if (max == 3) {
                    break;
                }
            }
        }
        System.out.println("父亲节是"+c.getTime());
    }
}
